<template>
  <div style="margin-left:15px;margin-top:15px">
      <el-form v-if="userInfo.type==='1'" :model="IllegalForm" :inline="true">
        <el-form-item label="预约人账号：">
          <el-input
            v-model="IllegalForm.accountNumber"
            placeholder="请输入"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item>
        <el-button @click="getIllegal()">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="IllegalData"
        border
        class="table"
        highlight-current-row>
         <el-table-column
          prop="user.accountNumber"
          label="预约人账号"
          min-width="100"
        >
         </el-table-column>
        <el-table-column
          prop="user.name"
          label="预约人姓名"
          min-width="100"
        >
        </el-table-column>
        <el-table-column
          prop="content"
          label="违规内容"
          min-width="100"
        >
        </el-table-column>
        <el-table-column
          prop="reduceCredit"
          label="扣除信用值"
          min-width="100"
        >
        </el-table-column>
        <el-table-column
          prop="illegalDate"
          label="违规时间"
          min-width="100"
        >
        </el-table-column>
    </el-table>
  </div>
</template>

<script>
import webservice from "@/utils/webservice";
export default {
    data(){
        return{
            IllegalForm:{},
            IllegalData:[],
        }
    },
    created(){
      this.userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
    },
    mounted(){
        this.getIllegal()
    },
    methods:{
        //记录
    getIllegal() {
      if(this.userInfo.type==='1'){
          var _param = {
        accountNumber: this.IllegalForm.accountNumber,
        };
      }else{
        var _param = {
            userId: this.userInfo.id,
        };
      }
      const _params = JSON.stringify(_param);
      webservice.HttpPost("/api/illegalRecord/selectIllegalRecordList", _params, (data) => {
        if (data.code === 200) {
          this.IllegalData = data.data;
        } else {
          this.$message.error({
            message: data.message,
            showClose: true,
            duration: 1000,
          });
        }
      });
    },
    }
}
</script>

<style>

</style>